using IQIGame.Onigao.GamePlay;

namespace IQIGame.Onigao.Game
{
    /// <summary>
    /// 路径常量，推荐使用string.Contact拼接，效率最高
    /// </summary>
    public class PathConstant : FrameworkPath
    {
        public const string TableResPath = "Res/11_Tables/";

        public const string SceneLightmapConfigPath = "Res/01_Scenes/LightmapConfig/";

        public const string CharacterPath = "Res/02_Character/";

        public const string EntityPath = "Res/03_Prefabs/Entity/";
        public const string Live2DPath = "Res/03_Prefabs/Live2D/";
        public const string MiniGameAssetRootPath = "Res/03_Prefabs/MiniGame";

        public const string NavMeshPath = "Res/12_ModuleCfg/NavMesh/";

        public const string SceneGameplayCfg = "Res/12_ModuleCfg/SceneGamePlay/";
        public const string SkillCfg = "Res/12_ModuleCfg/Skill/";
        public const string BattleCfg = "Res/12_ModuleCfg/Battle/";
        public const string TargetSelectPath = "Res/03_Prefabs/Common/Battle/TargetSelect/";
        public const string BattleCommonPrefabPath = "Res/03_Prefabs/Common/Battle/";

        public const string StoryCfgPath = "Res/12_ModuleCfg/Story/";
        public const string StoryActionCfgPath = "Res/12_ModuleCfg/StoryAction/StoryAction.bytes";
        public const string BehaviacCfgRoot = "Res/13_Behaviac";
        public const string BehaviacMetaName = "Behaviac";

        public const string TimelinePath = "Res/24_Timeline";

        public const string EffectPath = "Res/14_Effect/Prefab/";

        public const string ScriptableObjectPath = "Res/16_ScriptableConfig";

        public const string ConfigurableFSMRoot = "Res/25_ConfigurableFSM";

        public const string commonVFXAssetPath = "Res/03_Prefabs/Common/Timeline/common_entity_vfx.playable";

        public const string BehavScriptRoot = "Res/26_BehavScript/";
        
        private const string StoryBackgroundPath = "Res/05_Images/Texture/Story/Background/";
        
        
        private const string SpinePath = "Res/03_Prefabs/Spine/";
        private const string SpineAssetPath = "Res/04_ArtModel/Spine/";
        // Spine资源后缀
        private const string SkeletonDataSuffix = "_SkeletonData.asset";
        
        public static string GetUnitVideoPath(string roleName, string fileName)
        {
            return "Battle/" + roleName + "/" + fileName;
        }

        public static string GetAtlasSpritePath(string altasName, string spriteName)
        {
            // string Contact 超过4个参数，走了可选参数重载，GC多。所以有个参数用+连接，减为4参数
            return string.Concat(AtlasSpritePath, altasName, "/", spriteName + ".png");
        }

        public static string GetTexturePath(string texturePath)
        {
            return string.Concat(TexturePath, texturePath, ".png");
        }

        public static string GetSceneBlockPrefabPath(string sceneName, int xId, int zId)
        {
            return $"{ResABScenePath}{sceneName}/Prefab/{sceneName}_{zId.ToString()}_{xId.ToString()}.prefab";
        }

        public static string GetSceneLightmapConfigPath(string configName)
        {
            return string.Concat(SceneLightmapConfigPath, configName, ".asset");
        }

        public static string GetCharacterLevelPrefabPath(string prefabName)
        {
            return string.Concat(CharacterPath, prefabName, "/m_" + prefabName + ".prefab");
        }

        public static string GetEntityLevelPrefabPath(string prefabName)
        {
            return string.Concat(EntityPath, prefabName, "/m_" + prefabName + ".prefab");
        }

        public static string GetEffectPrefabPath(string prefabPath)
        {
            return string.Concat(EffectPath, prefabPath + ".prefab");
        }

        //public static string GetLevelEnvironmentCfg(string name)
        //{
        //    return LevelEnvironmentCfg + name + ".txt";
        //}

        public static string GetSceneGameplayCfg(string name)
        {
            return SceneGameplayCfg + name + ".bytes";
        }

        public static string GetNavMeshCfg(string name)
        {
            return NavMeshPath + name + ".bytes";
        }

        public static string GetBehaviacCfg(string name)
        {
            return $"{BehaviacCfgRoot}/{name}.bson.bytes";
        }

        public static string GetBehaviacMetaPath()
        {
            return $"{BehaviacCfgRoot}/meta/{BehaviacMetaName}.meta.bson.bytes";
        }

        // ReSharper restore Unity.ExpensiveCode
        public static string GetCharacterBattlePrefabPath(string prefabName)
        {
            return string.Concat(CharacterPath, prefabName, "/mb_" + prefabName + ".prefab");
        }

        public static string GetMonsterBattlePrefabPath(string prefabName)
        {
            return string.Concat(EntityPath, prefabName, "/mb_" + prefabName + ".prefab");
        }

        public static string GetHeroTimelinePath(string roleName, string timelineName)
        {
            return string.Concat(CharacterPath, roleName + "/Timeline/", timelineName + ".playable");
        }

        public static string GetMonsterTimelinePath(string roleName, string timelineName)
        {
            return string.Concat(EntityPath, roleName + "/Timeline/", timelineName + ".playable");
        }

        public static string GetJumpConfigAsset(string name)
        {
            return $"{ScriptableObjectPath}/JumpConfig/{name}.asset";
        }

        public static string GetSkillConfigPath(string folder, string name)
        {
            return SkillCfg + folder + "/" + string.Concat(name, ".bytes");
        }

        public static string GetSkillPrefabPath() => SkillCfg + "Prefab.bytes";

        public static string GetSkillSelectPath(string name)
        {
            return TargetSelectPath + name + ".prefab";
        }

        public static string GetBattleCommonPrefabPath(string name)
        {
            return BattleCommonPrefabPath + name + ".prefab";
        }

        public static string GetHeroEffectPath(string roleName, string effectName)
        {
            return string.Concat(CharacterPath, roleName, "/Effect/" + effectName + ".prefab");
        }

        public static string GetMonsterEffectPath(string roleName, string effectName)
        {
            return string.Concat(EntityPath, roleName, "/Effect/" + effectName + ".prefab");
        }

        public static string GetBattleHitEffectPath(string effectName)
        {
            return string.Concat(EffectPath, "hit_effect/", effectName, ".prefab");
        }

        public static string GetIconTypePath(string iconName)
        {
            return string.Concat(AtlasSpritePath, "Icon_Type/", iconName, ".png");
        }

        public static string GetBattleSpritePath(string spriteName)
        {
            return string.Concat(AtlasSpritePath, "UIBattle/", spriteName, ".png");
        }

        public static string GetStoryCfgPath(string storyName)
        {
            return string.Concat(StoryCfgPath, storyName, ".bytes");
        }

        public static string GetHUDConfigPath()
        {
            return string.Concat(ScriptableObjectPath, "/Battle/HUDConfig/BattleHUDAsset.asset");
        }

        public static string GetBulletConfigPath()
        {
            return string.Concat(ScriptableObjectPath, "/Battle/BulletConfig/BattleBulletAsset.asset");
        }

        public static string GetBattleCameraCurvePath(string roleName, string rCurveName)
        {
            return string.Concat(ScriptableObjectPath, "/Battle/CameraConfig/", roleName + "/" + rCurveName, ".asset");
        }

        public static string GetStateMachineConfigPath(string fileNameWithShortDir)
        {
            return $"{ConfigurableFSMRoot}/{fileNameWithShortDir}.bytes";
        }

        public static string GetCharacterEffectReuseConfigPath() => ScriptableObjectPath + "/Battle/EffectReuse/EffectReuse.asset";
        public static string GetCharacterEffectPreloadConfigPath() => ScriptableObjectPath + "/Battle/EffectReuse/EffectPreload.asset";

        public static string GetLive2DPath(string name) => Live2DPath + "ml_" + name + ".prefab";

        public static string GetHeroWidgetPath(string roleName, string widgetName)
        {
            if (string.IsNullOrEmpty(widgetName))
            {
                return string.Empty;
            }
            return CharacterPath + roleName + "/Widget/mb_" + widgetName + ".prefab";
        }

        public static string GetEntityVFXAssetPath(string entityName)
        {
            return $"{EntityPath}{entityName}/Timeline/{entityName}.playable";
        }

        public static string GetStoryTimelinePath(string name)
        {
            return TimelinePath + "/Story/" + name + ".playable";
        }

        public static string GetMiniGameAsset(GameplayAreaType areaType, string name)
        {
            return $"{MiniGameAssetRootPath}/{areaType.ToString()}/{name}.prefab";
        }

        public static string GetBehavScriptPath(string behavScriptName)
        {
            return BehavScriptRoot + behavScriptName + ".bytes";
        }

        public static string GetStoryBackground(string name)
        {
            return StoryBackgroundPath + name + ".png";
        }
        
        public static string GetSpineAssetPath(string name)
        {
            return SpineAssetPath + name + "/" + string.Concat(name,SkeletonDataSuffix);
        }
        
        public static string GetSpinePrefabPath(string name)
        {
            return SpinePath + "ms_" + name + ".prefab";
        }

        public static string GetBuffEffectPath(string name)
        {
            return string.Concat(EffectPath, "buff_effect/", name, ".prefab");
        }
    }
}
